/*
 * Copyright (c) 2024. hallele, Inc All rights reserved.
 */

package cn.hallele.ms.infrastructure.plugin.safety.encoder;

/**
 * hallele_mc_core
 *
 * @author anle5
 * @since 2024/11/10 15:39
 */
public interface PasswordEncoder {
    /**
     * Encode the raw password. Generally, a good encoding algorithm applies a SHA-1 or
     * greater hash combined with an 8-byte or greater randomly generated salt.
     *
     * @param rawPassword 明文
     */
    String encode(CharSequence rawPassword);

    /**
     * 校验密码
     *
     * @param rawPassword     原始密码
     * @param encodedPassword 编码密码
     * @return 校验通过返回true，其他false
     */
    boolean matches(String rawPassword, String encodedPassword);
}
